package com.atguigu.gmall.web.controller;

import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.client.OrderFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @Author: lx
 * @Time: 14:21
 * @Description:
 *
 *  支付
 *
 *   支付宝
 *
 */
@Controller
public class PayController {

    @Autowired
    private OrderFeignClient orderFeignClient;
    //进入支付页面
    @GetMapping("/pay.html")
    public String pay(Long orderId, Model model){

        //查询订单信息
        OrderInfo orderInfo = orderFeignClient.getOrderInfo(orderId);
        model.addAttribute("orderInfo",orderInfo);
        return "payment/pay";
    }
    //支付宝成功之后重定向过来的请求
    @GetMapping("/pay/success.html")
    public String paySuccess(){
        return "payment/success";
    }
}
